package com.tang.web;

import com.tang.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class AppearanceController {

    @Value("${server.port}")
    private int port;

    @GetMapping("/api/queryUserInfo")
    public UserInfo queryUserInfo(@RequestParam String userId){

        // 做白名单拦截
        List<String> userList = new ArrayList<>();
        userList.add("1001");
        userList.add("aaaa");
        userList.add("ccc");
        if (!userList.contains(userId)) {
            return new UserInfo("1111", "非白名单可访问用户拦截！");
        }

        return new UserInfo("汤汤"+ userId, 26, "成都市双流区牧华路三段南湖春天！");
    }

}
